package com.mazaiting.emotion.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.mazaiting.emotion.R
import com.mazaiting.emotion.model.ImageModel

/***
 *
 *
 *                                                    __----~~~~~~~~~~~------___
 *                                   .  .   ~~//====......          __--~ ~~
 *                   -.            \_|//     |||\\  ~~~~~~::::... /~
 *                ___-==_       _-~o~  \/    |||  \\            _/~~-
 *        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *  .~       .~       |   \\ -_    /  /-   /   ||      \   /
 * /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 * |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *          '         ~-|      /|    |-~\~~       __--~~
 *                      |-~~-_/ |    |   ~\_   _-~            /\
 *                           /  \     \__   \/~                \__
 *                       _--~ _/ | .-~~____--~-/                  ~~==.
 *                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                 -_     ~\      ~~---l__i__i__i--~~_/
 *                                 _-~-__   ~)  \--______________--~~
 *                               //.-~~~-~_--~- |-------~~~~~~~~
 *                                      //.-~~~--\
 *                               神兽保佑
 *                              代码无BUG!
 * @author mazaiting
 * @date 2019-08-08
 * @description 横向可复用列表适配器
 */
class HorizontalRecyclerViewAdapter : BaseQuickAdapter<ImageModel, BaseViewHolder>(R.layout.item_horizontal) {

    override fun convert(helper: BaseViewHolder?, item: ImageModel?) {
        if (null != helper && null != item) {
            // 设置icon
            helper.setImageDrawable(R.id.item_iv_icon, item.icon)
            // 设置背景颜色
            helper.setBackgroundColor(
                R.id.item_iv_icon,
                mContext.resources.getColor(
                    if (item.isSelected) R.color.bg_horizontal_btn_selected
                    else R.color.bg_horizontal_btn_normal
                )
            )
        }
    }

}